﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;



namespace DAO_HealthInsurance
{
   public class ConnectDatabase
   {
       private SqlConnection _Conn;

       public SqlConnection Conn
       {
           get { return _Conn; }
           set { _Conn = value; }
       }

      

        public ConnectDatabase() {
            string StrConnect = ConfigurationManager.ConnectionStrings["Connection"].ToString();
            Conn = new SqlConnection(StrConnect);
        }
        public void OpenConnect() {

            if (Conn.State == ConnectionState.Closed)
            {
                Conn.Open();
            
            }  
        }
        public void CloseConnect() {
            if (Conn.State == ConnectionState.Open)
            {
                Conn.Close();
                Conn = null;
            }
        }

      
    }
}
